home *** CD-ROM | disk | FTP | other *** search
- #include <sys/types.h>
- #include <sys/param.h>
- #include <sys/signal.h>
- #include <sys/immu.h>
- #include <sys/user.h>
- #include <sys/errno.h>
- #include <sys/sysmacros.h>
- #include <sys/map.h>
- #include <sys/mount.h>
- #include <sys/inode.h>
-
- void msopen () {
- }
-
- void msclose () {
- }
-
- void msioctl (dev, cmd, addr, flag) caddr_t addr; {
-
- register struct map *mp;
- struct inode *ip;
- char *led;
- int i, il, size, value;
- ushort x[3];
-
- switch (cmd) {
-
- .....
- case 201: /* set real, effective and saved user ids */
- if (copyin (&x, addr, sizeof x))
- u.u_error = EFAULT;
- u.u_ruid = x[0];
- u.u_uid = x[1];
- /* saved not supported in SYS V */
- break;
-
- case 202: /* set real, effective and saved group ids */
- if (copyin (&x, addr, sizeof x))
- u.u_error = EFAULT;
- u.u_rgid = x[0];
- u.u_gid = x[1];
- /* saved not supported in SYS V */
- break;
- .....
- default: u.u_error = EINVAL;
- break;
- }
- }
-
- $ static int miscdev = 0;
- int setresuid (r, e, s)
- int r,e,s; {
- short x[3];
- int stat;
- x[0]=r; x[1]=e; x[2]=s;
- if (!miscdev) miscdev = open ("/dev/misc",0);
- stat = ioctl (miscdev, 201, x);
- return stat;
- }
- int setresgid (r, e, s)
- int r,e,s; {
- short x[3];
- int stat;
- x[0]=r; x[1]=e; x[2]=s;
- if (!miscdev) miscdev = open ("/dev/misc",0);
- stat = ioctl (miscdev, 202, x);
- return stat;
- }
- $
-